package com.mjh.bean;

import java.util.Date;
import org.apache.struts2.json.annotations.JSON;
import com.mjh.comm.Constant;
import com.mjh.comm.page.Pager;
import com.mjh.config.GlobalConfig;

public class Article {

	private int id;
	
	private String title;
	
	private int category;
	
	private int artType;
	
	private String sourceUrl;
	
	private int clickNum;
	
	private String memo;
	
	private Date postTime;
	
	private String titlePic;
	
	private int status;
	
	private int isIndex;
	
	private Pager<ArticleDetail> detailsPage;
	
	public Article(){
		
	}
	
	public Article(Article a){
		this.id = a.id;
		this.title = a.title;
		this.category = a.category;
		this.artType = a.artType;
		this.sourceUrl = a.sourceUrl;
		this.clickNum = a.clickNum;
		this.memo = a.memo;
		this.postTime = a.postTime;
		this.titlePic = a.titlePic;
		this.status = a.status;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public int getArtType() {
		return artType;
	}

	public void setArtType(int artType) {
		this.artType = artType;
	}

	public String getSourceUrl() {
		return sourceUrl;
	}

	public void setSourceUrl(String sourceUrl) {
		this.sourceUrl = sourceUrl;
	}

	public int getClickNum() {
		return clickNum;
	}

	public void setClickNum(int clickNum) {
		this.clickNum = clickNum;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}
	
	@JSON(format="yyyy-MM-dd HH:mm")
	public Date getPostTime() {
		return postTime;
	}

	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	public String getStatusDesc(){
		return Constant.ARTICLE_STATE_DESC[this.status];
	}
	
	public String getCategoryDesc(){
		return GlobalConfig.getCategoryName(String.valueOf(this.category));
	}
	
	public String getArtTypeDesc(){
		return GlobalConfig.getCategoryName(String.valueOf(this.artType));
	}

	public String getIndexDesc(){
		return Constant.ARTICLE_INDEX_DESC[this.isIndex];
	}
	
	public Pager<ArticleDetail> getDetailsPage() {
		return detailsPage;
	}

	public void setDetailsPage(Pager<ArticleDetail> detailsPage) {
		this.detailsPage = detailsPage;
	}

	public String getTitlePic() {
		return titlePic;
	}

	public void setTitlePic(String titlePic) {
		this.titlePic = titlePic;
	}

	public int getIsIndex() {
		return isIndex;
	}

	public void setIsIndex(int isIndex) {
		this.isIndex = isIndex;
	}
}
